<template>
  <div class="Order">
    <ul class="header__tab">
      <li class="header__tab__item" :class="{'header__tab__item__active': search.type == 'all0'}" @click="setSearchType('all0')">全部</li>
      <li class="header__tab__item" :class="{'header__tab__item__active': search.type == 'all1'}" @click="setSearchType('all1')">售卖中</li>
      <li class="header__tab__item" :class="{'header__tab__item__active': search.type == 'all2'}" @click="setSearchType('all2')">审核中</li>
      <li class="header__tab__item" :class="{'header__tab__item__active': search.type == 'all3'}" @click="setSearchType('all3')">售完下架</li>
      <li class="header__tab__item" :class="{'header__tab__item__active': search.type == 'all4'}" @click="setSearchType('all4')">我下架的</li>
      <li class="header__tab__item" :class="{'header__tab__item__active': search.type == 'all5'}" @click="setSearchType('all5')">未上架的</li>
    </ul>
    <div class="Order__body">
      <div class="Order__contnet">
        <div class="Order__search">
          <div class="Order__search__right">
            <button class="Ecp-button-primary">搜索</button>
          </div>
          <div class="Order__search__left">
            <div class="Order__search__group">
              <span class="Order__search__name">商品名称</span>
              <input class="Order__search__input" style="width: 128px;" placeholder="请输入商品名称"/>
            </div>
            <div class="Order__search__group">
              <span class="Order__search__name">价格</span>
              <input class="Order__search__input" placeholder="单行输入"/>
              <span class="Order__search__name">至</span>
              <input class="Order__search__input" placeholder="单行输入"/>
            </div>
            <div class="Order__search__group">
              <span class="Order__search__name">店铺分类</span>
              <el-select
                v-model="routers"
                multiple
                collapse-tags
                style="width: 150px;"
                placeholder="路线筛选">
                <el-option
                  v-for="item in routerOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </div>
          </div>
        </div>
        <div class="Order__table__header">
          <div style="float:right;">
            <el-button size="mini" round>商家<i class="el-icon-caret-bottom el-icon--right"></i></el-button>
            <el-button size="mini" round>浏览量<i class="el-icon-caret-bottom el-icon--right"></i></el-button>
            <el-button size="mini" round>销量<i class="el-icon-caret-bottom el-icon--right"></i></el-button>
            <el-button size="mini" round>营收时间<i class="el-icon-caret-bottom el-icon--right"></i></el-button>
          </div>
          <div class="Order__table__header__left">
            <el-checkbox>全选</el-checkbox>
            <button class="Ecp-button-primary" style="margin-left:28px;height:28px;">查看销量数据</button>
          </div>
        </div>
        <div class="Order__table__body">
          <el-table
            :show-header="false"
            ref="multipleTable"
            :data="tableData3"
            style="width: 100%;font-size:16px;">
            <el-table-column
              type="selection"
              width="45">
            </el-table-column>
            <el-table-column
              label="产品"
              width="300">
              <div class="Order__table__card" slot-scope="scope">
                <img class="Order__table__card__img" :src="scope.row.imgUrl" alt="">
                <div class="Order__table__card__right">
                  <p class="Order__table__card__name">{{scope.row.name}}</p>
                  <p class="Order__table__card__name">{{scope.row.name}}</p>
                  <p class="Order__table__card__id">ID：{{scope.row.id}}</p>
                </div>
              </div>
            </el-table-column>
            <el-table-column>
              <div slot-scope="scope">
                <span>6家<br>1%↑</span>
              </div>
            </el-table-column>
            <el-table-column
              label="路线"
              show-overflow-tooltip>
              <div slot-scope="scope">
                <span>888<br>本月占33.3%<br>1%↑</span>
              </div>
            </el-table-column>
            <el-table-column
              label="送达时间">
              <div slot-scope="scope">
                <span>888<br>本月占33.3%<br>1%↑</span>
              </div>
            </el-table-column>
            <el-table-column
              label="服务">
              <div slot-scope="scope">
                <span>888<br>本月占33.3%<br>1%↑</span>
              </div>
            </el-table-column>
          </el-table>
          <div class="block" style="margin-top:15px;text-align: center;">
            <el-pagination
              layout="prev, pager, next"
              :total="50">
            </el-pagination>
          </div>
        </div>
      </div>
    </div>
    <!-- 修改订单弹层 -->
    <el-dialog
      top="66px"
      :visible.sync="dialogVisible"
      width="380px"
      class="Order__dialog"
      center>
      <el-form :model="form" ref="dialogForm" label-width="100px" label-position="left" class="Server__form">
        <el-form-item
          :rules="[{ required: true, message: '商品数量输入框'}]">
          <img style="vertical-align: middle;height:102px;" slot="label" :src="form.imgUrl">
          <p style="font-size: 16px; margin-bottom:10px;">{{form.name}}</p>
          <el-select
            v-model="routers"
            style="width: 100%;margin-bottom:17px;"
            placeholder="商品规格下拉列表">
            <el-option
              v-for="item in routerOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
          <!-- <el-input type="number" placeholder="商品数量输入框" auto-complete="off"></el-input> -->
          <input style="width:100%;" type="number" v-model.number="form.price" placeholder="商品数量输入框" auto-complete="off" class="Order__search__input">
        </el-form-item>
        <el-form-item
          label="订购服务"
          :rules="[
            { required: true, message: '请选择订购服务'}
          ]"
        >
          <el-select
            v-model="routers"
            style="width: 100%;"
            placeholder="服务下拉列表">
            <el-option
              v-for="item in routerOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="服务数量"
          :rules="[
            { required: true, message: '请设置服务数量'}
          ]"
        >
          <el-select
            v-model="routers"
            style="width: 100%;"
            placeholder="商品规格下拉列表">
            <el-option
              v-for="item in routerOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="商家地址"
          :rules="[{ required: true, message: '商家地址不能为空'}]">
          <el-input
            type="textarea"
            :rows="2"
            placeholder="请输入商家地址">
          </el-input>
        </el-form-item>
        <el-form-item
          label="分配路线"
          :rules="[
            { required: true, message: '请设置配送路线'}
          ]"
        >
          <el-select
            v-model="routers"
            style="width: 100%;"
            placeholder="设置配送路线">
            <el-option
              v-for="item in routerOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item
          label="送达时间"
          prop="time"
          :rules="[
            { required: true, message: '请设置送达时间'}
          ]"
        >
          <el-date-picker
            style="width:100%;"
            type="datetime"
            placeholder="设置送达时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item
          label="订单价格"
          prop="price"
          :rules="[
            { required: true, message: '价格不能为空'},
            { type: 'number', message: '价格必须为数字值'}
          ]"
        >
          <!-- <el-input v-model.number="form.price" placeholder="请输入价格" auto-complete="off"></el-input> -->
          <input style="width:100%;" type="number" v-model.number="form.price" placeholder="请输入价格" auto-complete="off" class="Order__search__input">
        </el-form-item>
      </el-form>
      <span slot="footer" class="Server__dialog__footer">
        <el-button type="text" @click="resetForm">取 消</el-button>
        <el-button type="text" style="margin-left:124px;" @click="dialogVisible=false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import testImg from '~/static/images/de.png'
  export default {
    data() {
      return {
        dialogVisible: false,
        tableData3: [{
          id: '123',
          name: '本草纲目',
          imgUrl: testImg,
          status: 0,
          router: '线路1',
          time: '送达时间2018-05-0312：00',
          service: '回空100x1',
          price: '900'
        },
        {
          id: '1234',
          name: '本草纲目1',
          imgUrl: testImg,
          status: 0,
          router: '线路1',
          time: '送达时间2018-05-0312：00',
          service: '回空100x1',
          price: '900'
        },
        {
          id: '1354',
          name: '本草纲目1',
          imgUrl: testImg,
          status: 0,
          router: '线路2',
          time: '送达时间2018-05-0312：00',
          service: '回空100x1',
          price: '900'
        }],
        defaultTimerPicker:{
          shortcuts: [{
            text: '最近一周',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            }
          }]
        },
        routerOptions: [{
          label:'店铺1',
          value: '1'
        },{
          label:'店铺2',
          value: '2'
        },{
          label:'店铺3',
          value: '3'
        }],
        search: {
          type: 'all0'
        },
        something: '',
        routers: [],
        form:{
          id: '',
          name: '',
          imgUrl: testImg,
          status: '',
          router: '',
          time: '',
          service: '',
          price: ''
        }
      }
    },
    methods: {
      resetForm() {
        this.$refs['dialogForm'].resetFields()
        this.dialogVisible = false
      },
      setSearchType (type) {
        this.search.type = type
      },
      editOrder(data) {
          this.form.id = data.id
          this.form.name = data.name
          this.form.imgUrl = data.imgUrl
          this.form.status = data.status
          this.form.router = data.router
          this.form.time = data.time
          this.form.service = data.service
          this.form.price = data.price
        this.dialogVisible = true
      }
    }
  }
</script>

<style lang="scss" scoped>
.Order {
  min-height: 100vh;
  background-color: #f3f3f3;
  &__dialog {
    & /deep/ {
      .el-form-item__label, .el-form-item__content {
        font-size: 16px;
        line-height: 25px;
      }
      .el-input__icon {
        line-height: 25px;
      }
      .el-tag--small {
        height: 20px;
        line-height: 20px;
      }
      .el-range-input, .el-textarea__inner {
        background-color: #f0f5fb;
      }
      .el-input__inner, .el-input--suffix{
        height: 25px;
        line-height: 25px;
        background-color: #f0f5fb;
        border: none;
        border-radius: 8px;
      }
      .el-date-editor {
        .el-input__icon {
          line-height: 25px;
        }
      }
    }
  }
  &__table {
    &__body {
      padding: 15px;
      text-align: center;
    }
    &__card {
      position: relative;
      text-align: left;
      &__img {
        float: left;
        width: 54px;
        height: 83px;
      }
      &__right {
        margin-left: 70px;
      }
      &__name {
        font-size: 16px;
        line-height: 18px;
        height: 27px;
      }
      &__id {
        font-size: 16px;
        line-height: 18px;
        margin-top: 11px;
      }
    }
    &__col {
      & /deep/ {
        .el-button--text {
          font-size: 16px;
        }
      }
      &__server {
        height: 83px;
        line-height: 83px;
        text-align: center;
        span {
          display: inline-block;
          line-height: 1em;
          width: 50%;
        }
      }
    }
    &__header {
      height: 58px;
      line-height: 28px;
      padding: 15px 26px;
      & /deep/ {
        .el-button {
          background-color: #f0f5fb;
          border: none;
        }
      }
    }
  }
  &__body {
    padding: 20px;
  }
  &__route {
    margin-right: 35px;
  }
  &__search {
    padding: 20px 20px;
    border-bottom: 1px solid #bdbdbd;
    & /deep/ {
      .el-input__icon {
        line-height: 25px;
      }
      .el-tag--small {
        height: 20px;
        line-height: 20px;
      }
      .el-range-input {
        background-color: #f0f5fb;
      }
      .el-input__inner, .el-input--suffix{
        height: 25px;
        line-height: 25px;
        background-color: #f0f5fb;
        border: none;
        border-radius: 8px;
      }
      .el-date-editor {
        .el-range__icon, .el-range__close-icon, .el-range-separator {
          line-height: 20px;
        }
      }
    }
    &__group {
      display: inline-block;
      margin-right: 28px;
    }
    &__name {
      vertical-align: middle;
      margin-right: 15px;
    }
    &__input {
      height: 25px;
      background-color: #f0f5fb;
      border-radius: 9px;
      vertical-align: middle;
      border: none;
      padding: 0 10px;
      text-align: center;
      font-size: 13px;
      width: 86px;
      &:focus {
        outline: none;
      }
    }
    &__left {
      margin-right: 108px;
      padding: 3px 0 3px 55px;
      position: relative;
      &:before {
        content: "";
        display: block;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background-color: #333856;
        position: absolute;
        top: 13px;
        left: 19px;
      }
    }
    &__right {
      float: right;
      width: 108px;
    }
  }
  &__contnet {
    background-color: #fff;
  }
}
</style>
